using System;
using System.Collections.Generic;

using Atomic.Libraries.Jobs;

namespace Atomic.Vasp
{
	[Serializable]
	public class VaspJob : Job<VaspResult>
	{
		private string summary;

		public VaspJob(VaspProblem problem, params Job[] dependencies)
			: this(problem, (IEnumerable<Job>)dependencies)
		{
		}

		public VaspJob(VaspProblem problem, IEnumerable<Job> dependencies)
			: this(problem, new JobResources(), dependencies)
		{
		}

		public VaspJob(VaspProblem problem, JobResources resources, params Job[] dependencies)
			: this(problem, resources, (IEnumerable<Job>)dependencies)
		{
		}

		public VaspJob(VaspProblem problem, JobResources resources, IEnumerable<Job> dependencies)
			: base(resources, dependencies)
		{
			Problem = problem;
		}

		public VaspJob(VaspProblem problem, string summary, params Job[] dependencies)
			: this(problem, summary, (IEnumerable<Job>)dependencies)
		{
		}

		public VaspJob(VaspProblem problem, string summary, IEnumerable<Job> dependencies)
			: this(problem, summary, new JobResources(), dependencies)
		{
		}

		public VaspJob(VaspProblem problem, string summary, JobResources resources, params Job[] dependencies)
			: this(problem, summary, resources, (IEnumerable<Job>)dependencies)
		{
		}

		public VaspJob(VaspProblem problem, string summary, JobResources resources, IEnumerable<Job> dependencies)
			: base(resources, dependencies)
		{
			this.summary = summary;

			Problem = problem;
		}

		protected override VaspResult RunResult()
		{
			return Problem.Run();
		}

		public VaspProblem Problem
		{
			get;
			private set;
		}

		public override string Summary
		{
			get
			{
				return summary ?? "-";
			}
		}
	}
}
